// RingBuffer.h - ring (round robin) buffer interface

#ifndef RINGBUFFER_H_
#define RINGBUFFER_H_

class RingBuffer
{
public:
     RingBuffer(int sizeBytes);
     ~RingBuffer();

     int Read(unsigned char* dataPtr, int numBytes);
     int Write(unsigned char *dataPtr, int numBytes);

     bool Empty(void);
     int GetSize();
     int GetWriteAvail();
     int GetReadAvail();
     void ShowBuffer();

private:
     unsigned char * m_data;
     int m_size;
     int m_readPtr;
     int m_writePtr;
     int m_writeBytesAvail;
     int m_writeMutexCount;
     int m_readMutexCount;
     pthread_mutex_t m_ring_buffer_mutex;
};

#endif /* RINGBUFFER_H_ */
